
var _util = require('util/util.js');
var _order_service = require('service/order-service.js');
var listTemplate = require('./index.string');

require('page/common/header/index.js');

var viewOrder = {
    listDate : {
        itemList    : {},
        productList : {}
    },
    init: function () {
        this.bindEvents();
        this.loadAccountInfo();
        return this;
    },
    bindEvents: function () {
    },
    loadAccountInfo : function(){
        var route = _util.getURLParam('route');
        var _this = this;
        _order_service.viewOders(
            route,
            function(res){
                console.log(res);
                
                _this.listDate.itemList = res;
                _this.listDate.productList = res.lineItems;
                var result = _util.renderHtml(listTemplate, {ListData : _this.listDate});
                $('#viewOrder').html(result);
            },
            function(errMsg) {
                console.log('errMsg...');
            }
        );
    }

}
module.exports = viewOrder.init();